package cn.tedu.hospital.inventory.controller;

import cn.tedu.hospital.base.response.JsonResult;
import cn.tedu.hospital.inventory.mapper.InventoryMapper;
import cn.tedu.hospital.inventory.pojo.dto.InventoryQuery;
import cn.tedu.hospital.inventory.pojo.vo.InventoryVO;
import cn.tedu.hospital.inventory.server.InventoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/v1/inventory")
public class InventoryController {
    @Autowired
    InventoryService inventoryService;
    @PostMapping("select")
    public JsonResult selectInventory(InventoryQuery inventoryQuery){
        log.debug("查询药品信息"+inventoryQuery);
        List<InventoryVO> list = inventoryService.selectInventory(inventoryQuery);
        return JsonResult.ok(list);
    }
    @GetMapping("add")
    public JsonResult addInventory(InventoryVO inventoryVO){
        log.debug("添加药品信息"+inventoryVO);
        inventoryService.addInventory(inventoryVO);
        return JsonResult.ok();
    }
}
